package it.enricod.jcontextfree.engine.model;

import it.enricod.jcontextfree.engine.model.vo.Position2D;

/**
 * quadrato che racchiude una figura
 * 
 * @author enrico
 *
 */
public class FigureRegion
{

    private Position2D p1;
    private Position2D p2;

    public FigureRegion(Position2D p1, Position2D p2)
    {
        this.p1 = p1;
        this.p2 = p2;
    }

    /**
     *
     * @return punto in basso a sinistra
     */
    public Position2D getP1()
    {
        return p1;
    }

    /**
     *
     * @return punto in alto a destra
     */
    public Position2D getP2()
    {
        return p2;
    }

    public double getWidth()
    {
        return p2.getX() - p1.getX();
    }

    public double getHeight()
    {
        return p2.getY() - p1.getY();
    }
}
